<?php
/**
* phpCan - http://idc.anavallasuiza.com/
*
* phpCan is released under the GNU Affero GPL version 3
*
* More information at license.txt
*/

defined('ANS') or die();

$Data->execute('check.php', true);

$ok = $Admin->saveEdit($Vars->arr('edit'));

if ($ok) {
	$Vars->message(__('Data has been saved succesfully!'), 'success');

	if ($Vars->get('redirect')) {
		redirect($Vars->get('redirect'), $Vars->getExitMode());
	}

	if ($ok['insert']) {
		redirect(path(true, true, implode(',', $ok['insert']), 'edit'));
	}

	return true;
}

$Vars->message(__('Ops, there was an error saving data!'), 'error');

return false;
?>
